﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Sys_AreaSelect : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string strSql;
        HZ.MBSM.DBUtility.Db db = new HZ.MBSM.DBUtility.Db();
        System.Data.IDataReader dr;

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        int intRootAreaId = SysFun.ToInt(Request.QueryString["ROOT"]);

        if (intRootAreaId == 0)
        {
            strSql = "Select * From Area Where AreaId % 10000 = 0";
        }
        else if (intRootAreaId % 10000 == 0)
        {
            strSql = "Select * From Area Where AreaId % 100 = 0 And AreaId>=" + intRootAreaId + " And AreaId<" + (intRootAreaId + 9900);
        }
        else
        {
            strSql = "Select * From Area Where AreaId>=" + intRootAreaId + " And AreaId<" + (intRootAreaId + 99);
        }
        dr = db.DataReader(strSql);
        while (dr.Read())
        {
            sb.Append("<span AreaId='" + SysFun.ToInt(dr["AreaId"]) + "' AreaName='" + SysFun.ToTrim(dr["AreaName"]) + "' style='behavior:url(../System/AreaSelect.htc)'></span>");
        }
        dr.Close();

        db.Close();

        this.labArea.Text = sb.ToString();
    }
}
